Add depth support to Garmin proprietary data that's tracked.
authorrobertl <robertl>
Tue, 23 Jun 2009 03:14:21 +0000 (03:14 +0000)
committerrobertl <robertl>
Tue, 23 Jun 2009 03:14:21 +0000 (03:14 +0000)
garmin.c
gpx.c

index 7737aadfa1dab9428756669c1300c35d5db341cf..f25ae9f391e812cfa5e81a98e32153c5612d0be9 100644 (file)
--- a/garmin.c
+++ b/garmin.c
@@ -468,7 +468,11 @@ track_read(void)
                wpt->creation_time = array[i]->Time;
                 wpt->wpt_flags.is_split = checkWayPointIsAtSplit(wpt, laps,
                                                                  nlaps);
-               
+               if (array[i]->dpth < 1.0e25f)
+                       WAYPT_SET(wpt, depth, array[i]->dpth);
+               if (array[i]->temperature_populated)
+                       WAYPT_SET(wpt, temperature, array[i]->temperature);
+
                track_add_wpt(trk_head, wpt);
        }
 
diff --git a/gpx.c b/gpx.c
index a8e98e51d69ad1cf8122a207637e378cd9d94007..e89b994f2d4dd2fa6e4930789f4c22572cf6cc1e 100644 (file)
--- a/gpx.c
+++ b/gpx.c
@@ -1595,15 +1595,25 @@ gpx_write_common_position(const waypoint *waypointp, const char *indent)
 static void
 gpx_write_common_depth(const waypoint *waypointp, const char *indent)
 {
-       if (waypointp->depth != 0) {
+       if (waypointp->depth != 0 || waypointp->temperature != 0) {
                if (opt_humminbirdext || opt_garminext) {
                        gbfprintf(ofd, "%s<extensions>\n", indent);
-                       if (opt_humminbirdext)
-                               gbfprintf(ofd, "%s  <h:depth>%f</h:depth>\n",
-                                         indent, waypointp->depth*100.0);
-                       if (opt_garminext)
-                               gbfprintf(ofd, "%s  <gpxx:Depth>%f</gpxx:Depth>\n",
-                                         indent, waypointp->depth);
+                       if (waypointp->depth != 0) {
+                               if (opt_humminbirdext)
+                                       gbfprintf(ofd, "%s  <h:depth>%f</h:depth>\n",
+                                                 indent, waypointp->depth*100.0);
+                               if (opt_garminext)
+                                       gbfprintf(ofd, "%s  <gpxx:Depth>%f</gpxx:Depth>\n",
+                                                 indent, waypointp->depth);
+                       }
+                       if (waypointp->temperature != 0) {
+                               if (opt_humminbirdext)
+                                       gbfprintf(ofd, "%s  <h:temperature>%f</h:temperature>\n",
+                                                 indent, waypointp->temperature);
+                               if (opt_garminext)
+                                       gbfprintf(ofd, "%s  <gpxx:Temperature>%f</gpxx:Temperature>\n",
+                                                 indent, waypointp->temperature);
+                       }
                        gbfprintf(ofd, "%s</extensions>\n", indent);
                }
        }